//
//  BEPriceTotalController.swift
//  BEGlobalOiler
//
//  Created by KKING on 16/9/12.
//  Copyright © 2016年 Bullseye Energy pte ltd. All rights reserved.
//

import UIKit

class BEPriceTotalController: UIViewController {
    
    
    @IBOutlet weak var table: UIView!
    
    var tableVi: JHTableChart = {
        let tableVi = JHTableChart()
        tableVi.tableTitleString = "价格组成详情";
        tableVi.colTitleArr = ["价格|工人","类型","单价/天","天数","薪水","总计"];
        //        tableVi.colTitleArr = ["price|tech","type","price/day","days","laborage","total"];
        //        table.colWidthArr = [120.0,70.0,70.0,70.0,70.0,120.0]
        tableVi.minHeightItems = 40
        tableVi.lineColor = COLOR_NAV_ITEM_NORMAL
        tableVi.backgroundColor = COLOR_ALL_BG
        return tableVi
    }()
    
    override func viewDidLoad() {
        super.viewDidLoad()
        view.backgroundColor = COLOR_ALL_BG
//        setTable()
    }
    
    override func viewDidLayoutSubviews() {
        super.viewWillLayoutSubviews()
        
        tableVi.frame = table.bounds
        tableVi.dataArr = [["zhang",["薪水","差旅","其他"],["80","20","30"],["3"],"240","240"],
                           ["lisi","80","4","320","20","340"],
                           ["laoli","80","4","320","0","320"],
                           ["总计","-","-","-","-","1220"]
        ]
        tableVi.showAnimation()
        table.addSubview(tableVi)
        
    }
    private func setTable(){
//        let tableVi = UIView(frame: journeyTable.bounds)

    }
    
    @IBAction func callAdminButtonDidClick(sender: UIButton) {
        let alertVC = UIAlertController(title: "CALL", message: "010-10086", preferredStyle: .alert)
        
        let cancleAction = UIAlertAction(title: "Cancle", style: .cancel, handler: nil)
        let doneAction = UIAlertAction(title: "OK", style: .default) { (_) in
            
            let url = NSURL(string: "tel://010-10010")
            UIApplication.shared.openURL(url! as URL)
        }
        
        alertVC.addAction(cancleAction)
        alertVC.addAction(doneAction)
        
        UIApplication.shared.keyWindow?.rootViewController!.present(alertVC, animated: true, completion: nil)
    }
    
}
